package pattern.factory.简单工厂;

public class SimpleCoffeeFactory {
    public static Coffee createCoffee(String type){
        Coffee coffee = null;
        if ("ACoffee".equals(type)){
            coffee = new ACoffee();
        }else if ("BCoffee".equals(type)){
            coffee = new BCoffee();
        }else {
            throw new RuntimeException("no such Coffee");
        }
        return coffee;
    }
}
